const Router = require('koa-router');
const router = new Router();
const teacherController = require('../controllers/teacher.controller');
const authMiddleware = require('../middlewares/auth.middleware');

// 教师相关API路由

// 获取所有教师列表
router.get('/', authMiddleware.authenticateToken, teacherController.getAllTeachers);

// 获取单个教师信息
router.get('/:id', authMiddleware.authenticateToken, teacherController.getTeacherById);

// 创建新教师
router.post('/', authMiddleware.authenticateToken, authMiddleware.authorize(['admin']), teacherController.createTeacher);

// 更新教师信息
router.put('/:id', authMiddleware.authenticateToken, authMiddleware.authorize(['admin', 'teacher']), teacherController.updateTeacher);

// 删除教师
router.delete('/:id', authMiddleware.authenticateToken, authMiddleware.authorize(['admin']), teacherController.deleteTeacher);

// 分页获取教师列表
router.get('/paginated/list', authMiddleware.authenticateToken, teacherController.getTeachersPaginated);

// 根据学院获取教师列表
router.get('/by-academy/:academy', authMiddleware.authenticateToken, teacherController.getTeachersByAcademy);

// 获取教师教授的科目
router.get('/:id/subjects', authMiddleware.authenticateToken, teacherController.getTeacherSubjects);

module.exports = router;